const mysql = require("./index");
function response(options) {
    return new Promise(async resolve => {
        try {
            console.log(options.qq)
            let sql="INSERT INTO qq_account (qq,password) VALUES";
            options.qq.forEach((element) => {
                sql+=' ('+element+') ,'
            });
            sql= sql.slice(0,sql.length-1)+';'
            console.log(sql)
            mysql(sql, function (error, results, fields) {
                if (error) throw error;
                resolve(results);
            });
            
        } catch (e) {
            console.log(e.message)
            resolve({ result: "failure ", errorMsg: e.message, status: (e.response || {}).status })
        }
    })
}
module.exports = async options =>{
    let res = await response(options);
    return res;
}